<template>
  <router-view />
</template>

<script setup>
import { onMounted, onBeforeUnmount } from 'vue'
import { useStore } from 'vuex'
// 导入 ResizeObserver 错误处理器
import { suppressResizeObserverErrors, restoreErrorHandlers } from './utils/resizeObserverErrorHandler'

// 导入覆盖层 CSS 修复 (在开发环境中)
if (process.env.NODE_ENV === 'development') {
  import('./utils/webpack-overlay-fix.css')
}

const store = useStore()

onMounted(() => {
  // 在应用启动时检查认证状态
  store.dispatch('checkAuth')
  
  // 再次确保错误处理器在组件挂载时生效
  suppressResizeObserverErrors()
})

onBeforeUnmount(() => {
  // 清理错误处理器
  restoreErrorHandlers()
})
</script>

<style>
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

#app {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 覆盖层特定样式，确保隐藏 ResizeObserver 错误 */
:deep(#webpack-dev-server-client-overlay[data-message*="ResizeObserver"]) {
  display: none !important;
}
</style> 